<template>
    <div>
        <bi-form>
            <bi-card>
                
                    <bi-form-item label="验证码" >
                        <bi-radio v-model="form.verificationCode" :option="verificationCodeOption" />
                    </bi-form-item>

                    <bi-form-item label="登录失败次数">
                        <bi-radio v-model="form.failNumber" :option="failNumberOption" />
                    </bi-form-item>

                    <bi-form-item label="失败禁止时间">
                        <bi-radio v-model="form.failTime" :option="failTimeOption" />
                    </bi-form-item>

                    <bi-form-item label="登陆壁纸"  >
                        <bi-file image v-model="form.wallpaper"  />
                    </bi-form-item>

                    <bi-form-item label="登录后跳转" >
                        <bi-select name="loginDirect" v-model="form.loginDirect">
                            <bi-select-option v-for="item in $pageData.loginDirectOption" :value="item.value"  :key="item.value" :label="item.title"></bi-select-option>
                        </bi-select>
                    </bi-form-item>
                <template #footer>
                            <bi-button type="primary" @click="save" :loading="loading"  icon="fa-save">保存</bi-button>
                </template>
            </bi-card>
        </bi-form>
    </div>
</template>

<script>
export default{
    data(){

        let form = {
            verificationCode:'no',
            failNumber:3,
            failTime:10,
            wallpaper:'',
            loginDirect:'',
        }
        
        form = this.$assign(form,this.$pageData.login);
        let verificationCodeOption = {
                'no':'不启用',
                'default':'默认验证码'
        }

        let failNumberOption = {
            3:'3次',
            5:'5次',
            10:'10次'
        }
        let failTimeOption = {
            10:'10分钟',
            30:'30分钟',
            60:'一小时',
            120:'俩小时',
            1440:'一天',
        }

        return {
            loading:false,
            form,
            verificationCodeOption,
            failNumberOption,
            failTimeOption,
            loggedShowOptions:[]
        }
    },
    methods:{
        save(){
            this.$ajax({
                url:this.$url({action:'saveLogin'}),
                data:this.form,
                success:()=>{
                    this.$toast('保存成功');
                }
            });
        }
    }
}
</script>